package com.ludomancy.sos64;


import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import com.ludomancy.gamelib.Button;
import com.ludomancy.gamelib.Utils;
import com.ludomancy.gamelib.Widget;

public class BriefingWidget extends Widget
{
	Accumulator display = new Accumulator(8000);
	
	public BriefingWidget(Widget parent, Rectangle area)
	{
		super(parent, area);
	}
	
	public void update()
	{
		display.update();
//		if(display.isDone())
//		{
//			leave();
//		}
	}
	
	public void paint(Graphics g)
	{
		g.setColor(Color.BLACK);
		g.fillRect(0, 0, getWidth(), getHeight());
		g.setColor(Sos64App.app.gameCanvas.theme.getDefaultTextColor());
		int offsetY = 10;
		Utils.drawMultiline(g, "File #13: SOS64 [Cancelled]", getWidth()-10, 5, offsetY);
		offsetY += g.getFontMetrics().getHeight()+2;
		g.drawLine(0, offsetY, getWidth(), offsetY);
		offsetY += 16;
		Utils.drawMultiline(g, "K.P. (Occupation: Poet)\n\"It is a mockery of sentience, life and beauty! Shut it down!\"\nVeredict: Archive and never restart the system again.", getWidth()-10, 5, offsetY);
	}

	public void onPress(Button widget)
	{
	}

	public void mouseDown(Point pos)
	{
		leave();
	}
	
	private void leave()
	{
		Sos64App.mainWidget.startGame();
	}
}
